class Dingdan2shangpinsController < ApplicationController
  # GET /dingdan2shangpins
  # GET /dingdan2shangpins.xml
  def index
    @dingdan2shangpins = Dingdan2shangpin.all

    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @dingdan2shangpins }
    end
  end

  # GET /dingdan2shangpins/1
  # GET /dingdan2shangpins/1.xml
  def show
    @dingdan2shangpin = Dingdan2shangpin.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @dingdan2shangpin }
    end
  end

  # GET /dingdan2shangpins/new
  # GET /dingdan2shangpins/new.xml
  def new
    @dingdan2shangpin = Dingdan2shangpin.new

    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @dingdan2shangpin }
    end
  end

  # GET /dingdan2shangpins/1/edit
  def edit
    @dingdan2shangpin = Dingdan2shangpin.find(params[:id])
  end

  # POST /dingdan2shangpins
  # POST /dingdan2shangpins.xml
  def create
    @dingdan2shangpin = Dingdan2shangpin.new(params[:dingdan2shangpin])

    respond_to do |format|
      if @dingdan2shangpin.save
        flash[:notice] = 'Dingdan2shangpin was successfully created.'
        format.html { redirect_to(@dingdan2shangpin) }
        format.xml  { render :xml => @dingdan2shangpin, :status => :created, :location => @dingdan2shangpin }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @dingdan2shangpin.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /dingdan2shangpins/1
  # PUT /dingdan2shangpins/1.xml
  def update
    @dingdan2shangpin = Dingdan2shangpin.find(params[:id])

    respond_to do |format|
      if @dingdan2shangpin.update_attributes(params[:dingdan2shangpin])
        flash[:notice] = 'Dingdan2shangpin was successfully updated.'
        format.html { redirect_to(@dingdan2shangpin) }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @dingdan2shangpin.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /dingdan2shangpins/1
  # DELETE /dingdan2shangpins/1.xml
  def destroy
    @dingdan2shangpin = Dingdan2shangpin.find(params[:id])
    @dingdan2shangpin.destroy

    respond_to do |format|
      format.html { redirect_to(dingdan2shangpins_url) }
      format.xml  { head :ok }
    end
  end
end
